//
//  FightTableViewCell.m
//  Associated Press indiana
//
//  Created by MK-MAC-001 on 15/7/21.
//  Copyright (c) 2015年 客官大大. All rights reserved.
//

#import "FightTableViewCell.h"
#import "CollectionViewCell.h"
@implementation FightTableViewCell

- (void)awakeFromNib {
    // Initialization code
    NSLog(@"wocaonidaye");
    [self create];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}
-(void)create
{           NSLog(@"fdsf");
            UICollectionViewFlowLayout *laout = [[UICollectionViewFlowLayout alloc] init];
            laout.itemSize = CGSizeMake(187.5, 187.5);
            laout.scrollDirection = UICollectionViewScrollDirectionVertical;
            laout.minimumInteritemSpacing = 0;
            laout.minimumLineSpacing = 0;
            self.collectionview = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, 375, 520) collectionViewLayout:laout];
            _collectionview.delegate = self;
            _collectionview.dataSource = self;
            [_collectionview registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
            _collectionview.backgroundColor = [UIColor whiteColor];
            _collectionview.pagingEnabled = NO;
    [self.contentView addSubview:_collectionview];

}
//-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
//{
//    if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
//        UICollectionReusableView *resuseview = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"headerResus" forIndexPath:indexPath];
//        UIScrollView *scro = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 375, 150)];
//        scro.backgroundColor = [UIColor yellowColor];
//
//
//        UIImage *image = [UIImage imageNamed:@"1.jpg"];
//        UIImageView *i1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 150)];
//        i1.image = image;
//        [scro addSubview:i1];
//        UIImage *imag1 = [UIImage imageNamed:@"2.jpg"];
//        UIImageView *i2 = [[UIImageView alloc] initWithFrame:CGRectMake(375, 0, 375, 150)];
//        i2.image = imag1;
//        [scro addSubview:i2];
//        UIImage *imag3 = [UIImage imageNamed:@"3.jpg"];
//        UIImageView *i3 = [[UIImageView alloc] initWithFrame:CGRectMake(750, 0, 375, 150)];
//        i3.image = imag3;
//        [scro addSubview:i3];
//        [resuseview addSubview:scro];
//        //非常重要的一个属性
//        scro.contentSize = CGSizeMake(self.contentView.frame.size.width*3, 150);
//
//        //分页滑动
//        scro.pagingEnabled = YES;
//
//        //不要scroview弹
//        scro.bounces = NO;
//
//        //又一个非常终于的属性(偏移量)
//        [scro setContentOffset:CGPointMake(0, 0)];
//
//
//       scro.delegate = self;
//        return resuseview;
//    }
//    return nil;
//}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 10;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UINib *nib = [UINib nibWithNibName:@"CollectionViewCell" bundle:[NSBundle mainBundle]];
    [_collectionview registerNib:nib forCellWithReuseIdentifier:@"collectioncell"];
    CollectionViewCell *cell = [[CollectionViewCell alloc]init];
    cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collectioncell" forIndexPath:indexPath];
//    CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
//cell = [[[NSBundle mainBundle] loadNibNamed:@"CollectionViewCell" owner:self options:nil]lastObject];
    cell.picer.image = [UIImage imageNamed:@"WeChat_1437377930.jpeg"];
//    [cell.button addTarget:self action:@selector(jiatu) forControlEvents:UIControlEventTouchUpInside];
//    cell.name.text = @"pingg";

    return cell;
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
